package com.nba.service.impl;

import java.util.List;

import com.nba.bean.Page;
import com.nba.bean.Schedule;
import com.nba.bean.inherit.GameInherit;
import com.nba.dao.GameDao;
import com.nba.dao.impl.GameDaoImpl;
import com.nba.service.GameService;

public class GameServiceImpl implements GameService {
	
	private GameDao gd = new GameDaoImpl();
	
	@Override
	public List<Schedule> getScheduleAll() {
		return gd.selectGameAll();
	}

	@Override
	public Schedule getScheduleById(String gameId) {
		return gd.selectGameById(gameId);
	}

	@Override
	public Page<GameInherit> getScheduleAll(String keyword, int pageNum, int pageSize) {
		List<GameInherit> schedule =  gd.SelectGameAll(keyword, pageNum, pageSize);
		int totalRows = gd.selectGameTotal(keyword);
		Page<GameInherit> page = new Page<GameInherit>(schedule, pageNum, pageSize, totalRows);
		return page;
	}

	@Override
	public int deleteSchedule(int gameId) {
		return gd.delectGameById(gameId);
	}

	@Override
	public int addSchedule(Schedule schedule) {
		return gd.insertGame(schedule);
	}

	@Override
	public int updateSchedule(Schedule schedule) {
		return gd.updateGame(schedule);
	}

}
